package com.mxt.moviedemo.dao;

import com.mxt.moviedemo.entity.PageRequest;
import com.mxt.moviedemo.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserMapper {
    User loginForPhone(String phone,String password);
    User loginForEmail(String email,String password);
    User loginByUsernameAndPassword(String uname, String password, String role);

    //添加||注册用户
    int registerUser(User user);
    int getNextUid();


    User getUserByUsername(String uname);


    int updateUser(User user);
    int updateTicketUsername(String uname,String newName);

    boolean recharge(@Param("username") String username, @Param("amount") double amount);

    List<User> getUsersByPage(PageRequest pageRequest);
    long getTotalUsers();


    List<User> searchUsersByName(String uname);

    boolean deleteUserByUuid(int uuid);

    int getUserIdByUsername(String uname);
}